<!DOCTYPE html>
<html xmlns:v-on="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="utf-8">
    <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" media="screen" />
    <meta http-equiv="X-UA-Compatible" ;content="IE=edge, chrome=1">
    <link rel="stylesheet" href="./static/css/news-list.css">
    <link rel="stylesheet" href="./static/css/commonality.css">
    <script src="./static/js/main.js"></script>
    <script src="./static/js/vue.min.js"></script>
    <link rel="stylesheet" href="./lib/layui/css/layui.css">
    <script src="./static/js/vue-resource.min.js" charset="utf-8"></script>
    <title>平利县产销分析</title>
</head>

<body>
    <div class="home" id="app">
        <div class="nav">
            <div class="nav-bar">
                <ul>
                    <li>
                        <a href="./news-list.html">新闻</a>
                    </li>
                    <li>
                        <a href="./goods-list.html">商品信息</a>
                    </li>
                    <li>
                        <a href="company-list.html">企业信息</a>
                    </li>
                    <li>
                        <a href="./output-value-detail.html">产值分析</a>
                    </li>
                    <li>
                        <a href="./map-detail.html">市场分布</a>
                    </li>
                    <li class="selectBar">
                        <a href="./product-list.html">产销分析</a>
                    </li>
                    <li>
                        <a href="./supply-demand-detail.html">供需分析</a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="slideshow">
            <div>
                平利县电商服务平台
            </div>
        </div>
        <div class="main">
            <div class="main-main">
                <div class="main-right">
                    <!--<div class="main-right-title">-->
                    <!--<div class="main-title-search">-->
                    <!--<div>-->
                    <!--<input type="text" placeholder="请输入关键字">-->
                    <!--</div>-->
                    <!--<div>-->
                    <!--搜索-->
                    <!--</div>-->
                    <!--</div>-->
                    <!--</div>-->
                    <div class="main-right-list">
                        <ul>
                            <li v-for="(item,index) in productList">
                                <div class="list-top" v-on:click="toDetail(item)">
                                    {{item.name}}
                                </div>
                                <div class="list-bottom">
                                    {{item.createDate}}
                                </div>
                            </li>
                            <li class="main-right-more">
                                <div @click="moreClick">{{moreBtn}}</div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script>
    var app = new Vue({
        el: "#app",
        data: {
            productList: [],
            pageIndex: 0,
            moreBtn: "查看更多"
        },
        methods: {
            moreClick: function () {
                console.info(this.pageIndex);
                this.$http.get(getHttpServer() + "/api/web/product", {
                    params: {
                        page: this.pageIndex,
                        size: 10
                    }
                }).then(function (response) {
                    var products = response.data.data.content;
                    if (products && products.length > 0) {
                        this.pageIndex = this.pageIndex + 1;
                        for (var v in products) {
                            this.productList.push(products[v]);
                        }

                    } else {
                        this.moreBtn = "没有更多了";
                    }

                }).catch(function (response) {
                });
            },
            toDetail: function (e) {
                location.href = "production-sales-detail.html?id=" + e.id;
            }
        }
    });

    app.moreClick();
</script>

</html>